﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Windows.Forms.Layout;
using DevExpress.XtraEditors;
using System.Drawing;
using DevExpress.XtraTab;

namespace RapChieuPhim.Class
{
    public class ClassAddNewTab
    {
        public void AddTab(XtraTabControl TabControl, string TabName, string TabText, UserControl UserControl)
        {
            XtraTabPage NewTab = new XtraTabPage();
            NewTab.Name = TabName;
            NewTab.Text = TabText;
            Boolean _flag = false;

            foreach (DevExpress.XtraTab.XtraTabPage tab in TabControl.TabPages)
            {
                if (tab.Name == NewTab.Name)
                {
                    TabControl.SelectedTabPage = tab;
                    _flag = true;
                }
            }
            if (!_flag)
            {
                NewTab.Controls.Add(UserControl);
                TabControl.TabPages.Add(NewTab);
                UserControl.Dock = DockStyle.Fill;
            }
        }
    }
}
